package com.itcam.path;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Author:Cammy.Wu
 * Date:2024-04-29
 * Description:
 */

@Controller
@RequestMapping("path")
@ResponseBody
public class PathController {
    // path/账号/密码

    // 动态路径设计 {key} = * {key} 在形参列表获取传入的参数
    // 接收路径参数 String account,String password -> 接收param格式参数
    // 必须使用@PathVariable
    @RequestMapping("{account}/{password}")
    public String login(@PathVariable(value = "account")String account,@PathVariable String password){
        System.out.println("account = " + account + ", password = " + password);
        return "account = " + account + ", password = " + password;
    }
}
